package com.longge;

public class PassThePillow {
    public int passThePillow(int n, int time) {

        int count = time + 1 / n;
        int num = time + 1 % n;

        if (count % 2 == 0) {
            return num;

        } else {
            return n - num;
        }
    }
}
